import {createApp} from 'vue'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import './style.css'
import App from './App.vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import {createPinia} from 'pinia'
import router from "@/router";
import { setupAssets } from './plugins/index'
import { resize } from '@/directives/resize'
const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.directive('resize',resize)
setupAssets()
// @ts-ignore
import VMdPreview from '@kangc/v-md-editor/lib/preview';
import '@kangc/v-md-editor/lib/style/base-editor.css';
// @ts-ignore
import vuepressTheme from '@kangc/v-md-editor/lib/theme/vuepress.js';
import '@kangc/v-md-editor/lib/theme/style/vuepress.css';

// @ts-ignore
import Prism from 'prismjs';

VMdPreview.use(vuepressTheme, {
  Prism,
});

// @ts-ignore
// import VMdPreviewHtml from '@kangc/v-md-editor/lib/preview-html';
// import '@kangc/v-md-editor/lib/style/preview-html.css';
// import '@kangc/v-md-editor/lib/theme/style/vuepress.css';

const pinia = createPinia()
pinia.use(({store}) => {

  const initialState = JSON.parse(JSON.stringify(store.$state));

  store.$reset = () => {

    store.$state = JSON.parse(JSON.stringify(initialState));

  }

});
app.use(VMdPreview)
app.use(router)
app.use(pinia)
app.use(ElementPlus)

app.mount('#app')
